clear

*install required stata packages (commented out but run these from the command line or uncomment)
*ssc install cibar
*ssc install estout

*set your directory here
cd "/Users/d31713r/Dropbox/Experiments in Politics spring 2020 class study/Data/Replication final/"

*open data
use "replication.dta"

*method of access

gen android=strpos(UserAgent,"Android")!=0
gen iphone=strpos(UserAgent,"iPhone")!=0
gen ipod=strpos(UserAgent,"iPod")!=0
gen ipad=strpos(UserAgent,"iPad")!=0
gen mac=strpos(UserAgent,"Macintosh")!=0
gen windows=strpos(UserAgent,"Windows")!=0
gen other=(android==0 & ipod==0 & iphone==0 & ipad==0 & windows==0 & mac==0)
gen mobile=(android==1 | iphone==1 | ipod==1)

*drop ineligibles
drop if intro==2
drop if age==1

*remove second response from IDs with duplicates
duplicates tag rid, gen(dupey)
sort rid StartDate 
gen n=_n
bysort rid: egen last=max(n)
sort rid StartDate
list StartDate rid last treatment if dupey>0
list StartDate rid treatment if dupey>0 & n==last
drop if dupey>0 & n==last

*demographics
tab age
gen agegroup=age
recode agegroup (2=1)(3=1)(4=2)(5=3)(6=4)(7=5)(8=5)(9=5)

gen male=(gender==1) if gender!=. & gender!=5
tab male

gen knowledge=0
replace knowledge=(know1==3)+(know2==2)+(know3==2)+(know4==2)+(know5==1)

egen races=rowtotal(race_*)
gen white=.
replace white=0 if races!=0
replace white=1 if race_1!=. & races<2

gen nonwhite=.
replace nonwhite=1 if white==0
replace nonwhite=0 if white==1

gen college=.
replace college=(edu>4 & edu<8) if edu!=.
tab college

gen pid7=.
replace pid7=1 if party==1 & repub_strength==1
replace pid7=2 if party==1 & repub_strength==2
replace pid7=3 if party>2 & party<5 & indparty==1
replace pid7=4 if party>2 & party<5 & (indparty==3 | indparty==.)
replace pid7=5 if party>2 & party<5 & indparty==2
replace pid7=6 if party==2 & dem_strength==2 
replace pid7=7 if party==2 & dem_strength==1
tab pid7

gen gop=(party==1 | indparty==1)
gen dem=(party==2 | indparty==2)

*pretreatment attitude measures
foreach var of varlist cc_threat cov_threat vacc_threat {
rename `var' `var'_old
gen `var'=`var'_old
recode `var' (5=1)(4=2)(2=4)(1=5)
}

gen interest=polint
recode interest (5=1)(4=2)(2=4)(1=5)

gen scientist_research=trust_sci_research
recode scientist_research (4=1)(2=3)(3=2)(1=4)

gen scientist_accurate=trust_sci_statements
recode scientist_accurate (4=1)(2=3)(3=2)(1=4)

gen sci_trust=(scientist_research+scientist_accurate)/2

gen approval=trump
recode approval (5=1)(4=2)(2=4)(1=5)

*manipulations
gen covid_first=(FL_602_DO_COVID_19Issue==1)
gen covid_second=(FL_602_DO_COVID_19Issue==2)
gen covid_third=(FL_602_DO_COVID_19Issue==3)

gen cc_first=(FL_602_DO_ClimateChangeIssue==1)
gen cc_second=(FL_602_DO_ClimateChangeIssue==2)
gen cc_third=(FL_602_DO_ClimateChangeIssue==3)

gen vac_first=(FL_602_DO_VaccinationIssue==1)
gen vac_second=(FL_602_DO_VaccinationIssue==2)
gen vac_third=(FL_602_DO_VaccinationIssue==3)

destring treatment, replace
gen control=(treatment==1)
gen misinfo=(treatment==2)
gen std_correction=(treatment==6)
gen sci_correction=(treatment==3)
gen dem_correction=(treatment==4)
gen rep_correction=(treatment==5)

gen cop_correction=((dem_correction==1 & dem==1) | (rep_correction==1 & gop==1)) if dem==1 | gop==1
gen opp_correction=((rep_correction==1 & dem==1) | (dem_correction==1 & gop==1)) if dem==1 | gop==1

*make sample balance table

putexcel set balance, replace
putexcel B1=("Control") C1=("Misinfo-only") D1=("Standard") E1=("Scientist") F1=("Democrat") G1=("Republican") H1=("Total")

gen fakewt=1 /*fake survey weights*/
svyset [pweight=fakewt] /*more convenient for output of proportions*/

/*gender marginals*/
putexcel A2=("Gender") A3=("Male") A4=("Female/other")

tab male treatment, chi

svy: tab male if control==1
matrix GenderControl = e(b)'
putexcel B3=matrix(GenderControl)

svy: tab male if misinfo==1
matrix GenderMisinfo = e(b)'
putexcel C3=matrix(GenderMisinfo)

svy: tab male if std_correction==1
matrix GenderCorrection = e(b)'
putexcel D3=matrix(GenderCorrection)

svy: tab male if sci_correction==1
matrix GenderSciCorrection = e(b)'
putexcel E3=matrix(GenderSciCorrection)

svy: tab male if dem_correction==1
matrix GenderDemCorrection = e(b)'
putexcel F3=matrix(GenderDemCorrection)

svy: tab male if rep_correction==1
matrix GenderRepCorrection = e(b)'
putexcel G3=matrix(GenderRepCorrection)

svy: tab male 
matrix GenderTotal = e(b)'
putexcel H3=matrix(GenderTotal)

/*education marginals*/
putexcel A6=("Education") A7=("Less than a bachelor's") A8=("College graduate")

tab college treatment, chi

svy: tab college if control==1
matrix CollegeControl = e(b)'
putexcel B7=matrix(CollegeControl)

svy: tab college if misinfo==1
matrix CollegeMisinfo = e(b)'
putexcel C7=matrix(CollegeMisinfo)

svy: tab college if std_correction==1
matrix CollegeCorrection = e(b)'
putexcel D7=matrix(CollegeCorrection)

svy: tab college if sci_correction==1
matrix CollegeSciCorrection = e(b)'
putexcel E7=matrix(CollegeSciCorrection)

svy: tab college if dem_correction==1
matrix CollegeDemCorrection = e(b)'
putexcel F7=matrix(CollegeDemCorrection)

svy: tab college if rep_correction==1
matrix CollegeRepCorrection = e(b)'
putexcel G7=matrix(CollegeRepCorrection)

svy: tab college 
matrix CollegeTotal = e(b)'
putexcel H7=matrix(CollegeTotal)

/*race marginals*/
putexcel A10=("Race/ethnicity") A11=("Non-white") A12=("White")

tab white treatment, chi

svy: tab white if control==1
matrix whiteControl = e(b)'
putexcel B11=matrix(whiteControl)

svy: tab white if misinfo==1
matrix whiteMisinfo = e(b)'
putexcel C11=matrix(whiteMisinfo)

svy: tab white if std_correction==1
matrix whiteCorrection = e(b)'
putexcel D11=matrix(whiteCorrection)

svy: tab white if sci_correction==1
matrix whiteSciCorrection = e(b)'
putexcel E11=matrix(whiteSciCorrection)

svy: tab white if dem_correction==1
matrix whiteDemCorrection = e(b)'
putexcel F11=matrix(whiteDemCorrection)

svy: tab white if rep_correction==1
matrix whiteRepCorrection = e(b)'
putexcel G11=matrix(whiteRepCorrection)

svy: tab white 
matrix whiteTotal = e(b)'
putexcel H11=matrix(whiteTotal)

/*median marginals*/
putexcel A14=("Age") A15=("18-34") A16=("35-44") A17=("45-54") A18=("55-64") A19=("65+")

tab agegroup treatment, chi

svy: tab agegroup if control==1
matrix agegroupControl = e(b)'
putexcel B15=matrix(agegroupControl)

svy: tab agegroup if misinfo==1
matrix agegroupMisinfo = e(b)'
putexcel C15=matrix(agegroupMisinfo)

svy: tab agegroup if std_correction==1
matrix agegroupCorrection = e(b)'
putexcel D15=matrix(agegroupCorrection)

svy: tab agegroup if sci_correction==1
matrix agegroupSciCorrection = e(b)'
putexcel E15=matrix(agegroupSciCorrection)

svy: tab agegroup if dem_correction==1
matrix agegroupDemCorrection = e(b)'
putexcel F15=matrix(agegroupDemCorrection)

svy: tab agegroup if rep_correction==1
matrix agegroupRepCorrection = e(b)'
putexcel G15=matrix(agegroupRepCorrection)

tab agegroup 
matrix agegroupTotal = e(b)'
putexcel H15=matrix(agegroupTotal)

*attention checks
gen chef_check=.
replace chef_check=(cc_filler_q1==4) if cc_filler_q1!=.
replace chef_check=(cc_filler_q1_0==4) if cc_filler_q1_0!=.
replace chef_check=(cov_filler_q1==4) if cov_filler_q1!=.
replace chef_check=(cov_filler_q1_0==4) if cov_filler_q1_0!=.
replace chef_check=(vac_filler_q1==4) if vac_filler_q1!=.
replace chef_check=(vac_filler_q1_0==4) if vac_filler_q1_0!=.

gen bird_check=.
replace bird_check=(cc_filler_q2==4) if cc_filler_q2!=.
replace bird_check=(cc_filler_q2_0==4) if cc_filler_q2_0!=.
replace bird_check=(cov_filler_q2==4) if cov_filler_q2!=.
replace bird_check=(cov_filler_q2_0==4) if cov_filler_q2_0!=.
replace bird_check=(vac_filler_q2==4) if vac_filler_q2!=.
replace bird_check=(vac_filler_q2_0==4) if vac_filler_q2_0!=.

tab chef_check
tab bird_check

gen cc_misinfo_check=.
replace cc_misinfo_check=(cc_misinfo_man_check==2) if cc_misinfo_man_check!=.

gen cov_misinfo_check=.
replace cov_misinfo_check=(cov_misinfo_man_chec==2) if cov_misinfo_man_chec!=.

gen vac_misinfo_check=. 
replace vac_misinfo_check=(vac_misinfo_man==2) if vac_misinfo_man!=.

tab cc_misinfo_check
tab cov_misinfo_check
tab vac_misinfo_check

gen mcsum_all=(chef_check+bird_check+cc_misinfo_check+cov_misinfo_check+vac_misinfo_check) if treatment_group>1
tab mcsum_all

gen mcsum=(cc_misinfo_check+cov_misinfo_check+vac_misinfo_check) if treatment_group>1
tab mcsum

gen cc_corr_check=.
replace cc_corr_check=(cc_corr_man_ch_sci==1) if cc_corr_man_ch_sci_DO_1!=.
replace cc_corr_check=(cc_corr_man_ch_dem==1) if cc_corr_man_ch_dem_DO_1!=.
replace cc_corr_check=(cc_corr_man_ch_rep==1) if cc_corr_man_ch_rep_DO_1!=.
replace cc_corr_check=(cc_corr_man_ch_nocon==1) if cc_corr_man_ch_nocon_DO_1!=.

tab cc_corr_man_ch_sci /*79%*/

gen cc_mc_opp=cc_corr_man_ch_dem if gop==1 
replace cc_mc_opp=cc_corr_man_ch_rep if dem==1
gen cc_mc_cop=cc_corr_man_ch_dem if dem==1 
replace cc_mc_cop=cc_corr_man_ch_rep if gop==1

tab cc_mc_opp /*79%*/ 
tab cc_mc_cop /*81%*/

tab cc_corr_man_ch_nocon /*85%*/

gen cov_corr_check=.
replace cov_corr_check=(cov_cor_man_ch_sc==3) if cov_cor_man_ch_sc_DO_1!=.
replace cov_corr_check=(cov_cor_man_ch_dem==3) if cov_cor_man_ch_dem_DO_1!=.
replace cov_corr_check=(cov_cor_man_ch_rep==3) if cov_cor_man_ch_rep_DO_1!=.
replace cov_corr_check=(cov_cor_man_ch_nocon==1) if cov_cor_man_ch_nocon_DO_1!=.

tab cov_cor_man_ch_sc /*81%*/

gen cov_mc_opp=cov_cor_man_ch_dem if gop==1 
replace cov_mc_opp=cov_cor_man_ch_rep if dem==1
gen cov_mc_cop=cov_cor_man_ch_dem if dem==1 
replace cov_mc_cop=cov_cor_man_ch_rep if gop==1

tab cov_mc_opp /*80%*/ 
tab cov_mc_cop /*83%*/

tab cov_cor_man_ch_nocon /*83%*/

gen vac_corr_check=.
replace vac_corr_check=(vac_corr_sci_man==2) if vac_corr_sci_man_DO_1!=.
replace vac_corr_check=(vac_corr_dem_man==2) if vac_corr_dem_man_DO_1!=.
replace vac_corr_check=(vac_corr_rep_man==2) if vac_corr_rep_man_DO_1!=.
replace vac_corr_check=(vac_corr_gen_man==2) if vac_corr_gen_man_DO_1!=.

tab vac_corr_sci_man /*81%*/

gen vac_mc_opp=vac_corr_dem_man if gop==1 
replace vac_mc_opp=vac_corr_rep_man if dem==1
gen vac_mc_cop=vac_corr_dem_man if dem==1 
replace vac_mc_cop=vac_corr_rep_man if gop==1

tab vac_mc_opp /*77%*/ 
tab vac_mc_cop /*81%*/

tab vac_corr_gen_man /*82%*/

tab cc_corr_check
tab cov_corr_check
tab vac_corr_check

gen corrsum=(cc_corr_check+cov_corr_check+vac_corr_check) if treatment_group>2

tab mcsum
tab corrsum

gen total_attention=mcsum+corrsum

*outcome measures/toplines
tab cc_dv_accuracy 
tab cc_dv_accuracy if control==1
tab cov_dv_accuracy
tab cov_dv_accuracy if control==1
tab vac_dv_accuracy
tab vac_dv_accuracy if control==1

tab cc_dv_petition 
tab cov_dv_petition
tab vac_dv_petition

gen cc_dv_credible=.
replace cc_dv_credible=cc_dv_credible_nocon if cc_dv_credible_nocon!=.
replace cc_dv_credible=cc_dv_credible_sci if cc_dv_credible_sci!=.
replace cc_dv_credible=cc_dv_credible_dem if cc_dv_credible_dem!=.
replace cc_dv_credible=cc_dv_credible_rep if cc_dv_credible_rep!=.

gen cov_dv_credible=.
replace cov_dv_credible=cov_dv_credible_nonc if cov_dv_credible_nonc!=.
replace cov_dv_credible=cov_dv_credible_sci if cov_dv_credible_sci!=.
replace cov_dv_credible=cov_dv_credible_dem if cov_dv_credible_dem!=.
replace cov_dv_credible=cov_dv_credible_rep if cov_dv_credible_rep!=.

gen vac_dv_credible=.
replace vac_dv_credible=vac_dv_cred_noncon if vac_dv_cred_noncon!=.
replace vac_dv_credible=vac_dv_cred_sci if vac_dv_cred_sci!=.
replace vac_dv_credible=vac_dv_cred_dem if vac_dv_cred_dem!=.
replace vac_dv_credible=vac_dv_cred_rep if vac_dv_cred_rep!=.

*mean checking
su *dv_accuracy
su *dv_petition
su *dv_credible

*randomization
tab treatment_group

*treatments
su control misinfo std_correction sci_correction cop_correction opp_correction

*controls
su interest knowledge sci_trust approval nonwhite college dem gop agegroup male

*order vars
su cc_second cc_third covid_second covid_third vac_second vac_third

*analyses

/*
Baseline polarization and salience:

Based on public survey data, we expect that that polarization and perceived personal threat vary across the three issues studied: COVID-19, climate change, and vaccination. We employ the following tests to evaluate these expectations at baseline (pre-treatment measures):
-COVID poses the most perceived personal threat, with vaccination second and climate change the least threatening
-Climate change is the most polarized issue, with COVID-19 second and vaccination the least polarized
*/

*order effects analysis

preserve

rename cc_dv_accuracy accuracy1
rename cov_dv_accuracy accuracy2
rename vac_dv_accuracy accuracy3

reshape long accuracy, i(rid) j(issue)

gen climate=(issue==1)
gen covid=(issue==2)
gen vaccine=(issue==3)

gen second=.
replace second=cc_second if climate==1
replace second=covid_second if covid==1
replace second=vac_second if vaccine==1

gen third=.
replace third=cc_third if climate==1
replace third=covid_third if covid==1
replace third=vac_third if vaccine==1

gen four_cond=.
replace four_cond=1 if control==1
replace four_cond=2 if misinfo==1
replace four_cond=3 if std_correction==1 | sci_correction==1 |  cop_correction==1
replace four_cond=4 if opp_correction==1

label def condlab 1 "Control" 2 "Misinfo" 3 "Non-opp. correction" 4 "Opp. correction"
label val four_cond condlab

label def issuelab 1 "Climate" 2 "COVID-19" 3 "Vaccine"
label val issue issuelab

gen order=.
replace order=1 if second==0 & third==0
replace order=2 if second==1 & third==0
replace order=3 if second==0 & third==1

label def orderlab 1 "1st" 2 "2nd" 3 "3rd"
label val order orderlab 

gen received_corr=.
replace received_corr=0 if four_cond<3 
replace received_corr=1 if four_cond==3 | four_cond==4

reg accuracy misinfo received_corr interest knowledge sci_trust approval nonwhite college gop male i.agegroup second third, robust cluster(rid)
lincom received_corr-misinfo

cibar accuracy, over(four_cond order issue) vce(cluster rid) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/issue-order.png", replace

cibar accuracy if issue==1, over(four_cond order) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)) title("Climate",size(*.8)))
graph export "Figures/climate-order.png", replace
cibar accuracy if issue==2, over(four_cond order) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)) title("COVID-19",size(*.8)))
graph export "Figures/covid-order.png", replace
cibar accuracy if issue==3, over(four_cond order) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)) title("Vaccine",size(*.8)))
graph export "Figures/vaccine-order.png", replace

reg accuracy misinfo##second misinfo##third std_correction##second std_correction##third sci_correction##second sci_correction##third cop_correction##second cop_correction##third opp_correction##second opp_correction##third interest knowledge sci_trust approval nonwhite college gop male i.agegroup, robust cluster(rid)
est store A
estout A using "Tables/accuracy-order-table.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

*deviation to add non-interaction order terms
test 1.second=1.third=1.misinfo#1.second=1.misinfo#1.third=1.std_correction#1.second=1.std_correction#1.third=1.sci_correction#1.second=1.sci_correction#1.third=1.cop_correction#1.second=1.cop_correction#1.third=1.opp_correction#1.second=1.opp_correction#1.third=0

restore


*set all issue-specific outcomes to missing when those issues were seen second or third

foreach var of varlist cc_dv_accuracy cc_dv_credible cc_dv_petition cc_misinfo_check cc_corr_check {
replace `var'=. if cc_second==1 | cc_third==1
}

foreach var of varlist cov_dv_accuracy cov_dv_credible cov_dv_petition cov_misinfo_check cov_corr_check {
replace `var'=. if covid_second==1 | covid_third==1
}

foreach var of varlist vac_dv_accuracy vac_dv_credible vac_dv_petition vac_misinfo_check vac_corr_check {
replace `var'=. if vac_second==1 | vac_third==1
}

*threat/polarization 

preserve 

rename cc_threat threat1
rename cov_threat threat2
rename vacc_threat threat3

reshape long threat, i(rid) j(issue)

gen climate=(issue==1)
gen covid=(issue==2)
gen vaccine=(issue==3)

*potential deviation: using random effects in first, clustering for both

reg threat climate covid, cluster(rid)
lincom climate-covid

egen id=group(rid)
xtset id issue
xtreg threat climate covid, cluster(rid) 
lincom climate-covid

reg threat climate covid if dem==1 | gop==1, cluster(rid)
lincom climate-covid
est store A
estout A using "Tables/polarized.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

reg threat climate##gop covid##gop if dem==1 | gop==1, cluster(rid)
est store B
estout B using "Tables/polarized-party.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
lincom 1.climate#1.gop-1.covid#1.gop 
lincom 1.climate#1.gop-1.gop
/*corrected*/
lincom 1.climate#1.gop
lincom 1.covid#1.gop-1.gop
/*corrected*/
lincom 1.covid#1.gop

bysort climate covid vaccine dem gop: su threat if dem==1 | gop==1

restore

/*
throughout: RQ5:
We will repeat the analyses above using analogous measures of willingness to sign a relevant petition (pooled or by issue) as the outcome variable rather than the perceived accuracy of false or unsupported claims.
*/

/*
H1: Participants who receive a correction will rate false or unsupported claims about climate change (H1a), COVID-19 (H1b), and vaccination (H1c) as less accurate than participants who receive misinformation but no correction.
*/

*deviations throughout: cop_correction, opp_correction missing for non-Ds/non-Rs; so dem variable removed because collinear

reg cc_dv_accuracy misinfo std_correction sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup /*cc_second cc_third*/, robust
est store A1
lincom std_correction-misinfo
lincom sci_correction-misinfo
lincom cop_correction-misinfo
lincom opp_correction-misinfo

/*H2: Participants who receive a co-partisan or scientist endorsement of a correction citing a consensus will rate the claim as less accurate (H2a) and rate the source of the correction as more credible (H2b) than those who received a correction that does not cite a consensus.*/

*H2a
lincom sci_correction - std_correction
lincom cop_correction - std_correction

/*RQ3: For issues with substantial polarization (climate change and COVID-19), how will an opposition party endorsement of the scientific consensus affect the perceived accuracy of the misinformation claim relative to a scientist endorsement?*/

*RQ3
lincom opp_correction-sci_correction

reg cc_dv_petition misinfo std_correction sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup /*cc_second cc_third*/, robust
est store A2

lincom std_correction-misinfo
lincom sci_correction-misinfo
lincom cop_correction-misinfo
lincom opp_correction-misinfo

lincom sci_correction - std_correction
lincom cop_correction - std_correction
lincom opp_correction-sci_correction

reg cov_dv_accuracy misinfo std_correction sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup  /*covid_second covid_third*/, robust
est store B1

lincom std_correction-misinfo
lincom sci_correction-misinfo
lincom cop_correction-misinfo
lincom opp_correction-misinfo

*H2a
lincom sci_correction - std_correction
lincom cop_correction - std_correction

*RQ1
lincom sci_correction-cop_correction

*RQ3
lincom opp_correction-sci_correction

reg cov_dv_petition misinfo std_correction sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup  /*covid_second covid_third*/, robust
est store B2

lincom std_correction-misinfo
lincom sci_correction-misinfo
lincom cop_correction-misinfo
lincom opp_correction-misinfo

lincom sci_correction - std_correction
lincom cop_correction - std_correction
lincom sci_correction-cop_correction
lincom opp_correction-sci_correction

reg vac_dv_accuracy misinfo std_correction sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup  /*vac_second vac_third*/, robust
est store C1

lincom std_correction-misinfo
lincom sci_correction-misinfo
lincom cop_correction-misinfo
lincom opp_correction-misinfo

/*H2: Participants who receive a co-partisan or scientist endorsement of a correction citing a consensus will rate the claim as less accurate (H2a) and rate the source of the correction as more credible (H2b) than those who received a correction that does not cite a consensus.*/

*H2a
lincom sci_correction - std_correction
lincom cop_correction - std_correction

reg vac_dv_petition misinfo std_correction sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup  /*vac_second vac_third*/, robust
est store C2

lincom std_correction-misinfo
lincom sci_correction-misinfo
lincom cop_correction-misinfo
lincom opp_correction-misinfo

lincom sci_correction - std_correction
lincom cop_correction - std_correction

estout A1 B1 C1 using "Tables/accuracy-issue-table.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

estout A2 B2 C2 using "Tables/petition-issue-table.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

*We may also estimate models with a combined correction treatment variable:
*reg <issue-specific accuracy DVs> misinfo received_corr, robust 
*lincom received_corr-misinfo

preserve 

rename cc_dv_accuracy accuracy1
rename cov_dv_accuracy accuracy2
rename vac_dv_accuracy accuracy3

reshape long accuracy, i(rid) j(issue)

gen climate=(issue==1)
gen covid=(issue==2)
gen vaccine=(issue==3)

gen first=.
replace first=cc_first if climate==1
replace first=covid_first if covid==1
replace first=vac_first if vaccine==1

gen second=.
replace second=cc_second if climate==1
replace second=covid_second if covid==1
replace second=vac_second if vaccine==1

gen third=.
replace third=cc_third if climate==1
replace third=covid_third if covid==1
replace third=vac_third if vaccine==1

gen received_corr=(treatment_group>2)

reg accuracy misinfo received_corr interest knowledge sci_trust approval nonwhite college gop male i.agegroup second third, robust cluster(rid)
lincom received_corr-misinfo

restore

/*H2: Participants who receive a co-partisan or scientist endorsement of a correction citing a consensus will rate the claim as less accurate (H2a) and rate the source of the correction as more credible (H2b) than those who received a correction that does not cite a consensus.*/

*H2b
reg cc_dv_credible sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup /*cc_second cc_third*/, robust 
est store C1

reg cov_dv_credible sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup  /*covid_second covid_third*/, robust 
est store C2

reg vac_dv_credible sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup  /*vac_second vac_third*/, robust 
est store C3

estout C1 C2 C3 using "Tables/credible-issue-table.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

*RQ4
reg cc_dv_accuracy misinfo##gop std_correction##gop sci_correction##gop cop_correction##gop opp_correction##gop interest knowledge sci_trust approval nonwhite college male i.agegroup cc_second cc_third if (dem==1 | gop==1), robust
est store D1

*RQ3 surprise/backfire
lincom 1.opp_corr-1.sci_corr /*dem*/
lincom 1.opp_corr+1.opp_corr#1.gop-(1.sci_corr+1.sci_corr#1.gop) /*gop*/
lincom 1.opp_corr#1.gop-1.sci_corr#1.gop /*diff in diff*/

*RQ4
reg cov_dv_accuracy misinfo##gop std_correction##gop sci_correction##gop cop_correction##gop opp_correction##gop interest knowledge sci_trust approval nonwhite college male i.agegroup covid_second covid_third if (dem==1 | gop==1), robust
est store D2

*RQ3 surprise/backfire
lincom 1.opp_corr-1.sci_corr /*dem*/
lincom 1.opp_corr+1.opp_corr#1.gop-(1.sci_corr+1.sci_corr#1.gop) /*gop*/
lincom 1.opp_corr#1.gop-1.sci_corr#1.gop /*diff in diff*/

estout D1 D2 using "Tables/accuracy-party-interactions.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

*pooled accuracy models

preserve

rename cc_dv_accuracy accuracy1
rename cov_dv_accuracy accuracy2
rename vac_dv_accuracy accuracy3

reshape long accuracy, i(rid) j(issue)

gen climate=(issue==1)
gen covid=(issue==2)
gen vaccine=(issue==3)

gen second=.
replace second=cc_second if climate==1
replace second=covid_second if covid==1
replace second=vac_second if vaccine==1

gen third=.
replace third=cc_third if climate==1
replace third=covid_third if covid==1
replace third=vac_third if vaccine==1

*H3
reg accuracy misinfo##climate misinfo##covid std_correction##climate std_correction##covid sci_correction##climate sci_correction##covid cop_correction##climate cop_correction##covid opp_correction##climate opp_correction##covid interest knowledge sci_trust approval nonwhite college gop male i.agegroup /*second third*/, cluster(rid)
est store E

estout E using "Tables/accuracy-pooled.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

*exploratory
reg accuracy misinfo##climate misinfo##covid std_correction##climate std_correction##covid sci_correction##climate sci_correction##covid cop_correction##climate cop_correction##covid opp_correction##climate opp_correction##covid, cluster(rid)

*deviation: typos corrected

*H3a 
lincom 1.cop_correction#1.climate - 1.sci_correction#1.climate

*H3b
lincom (1.cop_correction#1.covid - 1.sci_correction#1.covid)-(1.cop_correction#1.climate - 1.sci_correction#1.climate)

*RQ2
lincom 1.cop_correction#1.covid - 1.sci_correction#1.covid

reg accuracy misinfo##climate misinfo##covid std_correction##climate std_correction##covid sci_correction##climate sci_correction##covid cop_correction##climate cop_correction##covid opp_correction##climate opp_correction##covid if issue==1, cluster(rid)

reg accuracy misinfo##climate misinfo##covid std_correction##climate std_correction##covid sci_correction##climate sci_correction##covid cop_correction##climate cop_correction##covid opp_correction##climate opp_correction##covid if issue==2, cluster(rid)

reg accuracy misinfo##climate misinfo##covid std_correction##climate std_correction##covid sci_correction##climate sci_correction##covid cop_correction##climate cop_correction##covid opp_correction##climate opp_correction##covid if issue==3, cluster(rid)

gen condition=.
replace condition=1 if control==1
replace condition=2 if misinfo==1
replace condition=3 if std_correction==1 
replace condition=4 if sci_correction==1 
replace condition=5 if cop_correction==1
replace condition=6 if opp_correction==1

label def condlab2 1 "Control" 2 "Misinformation-only" 3 "Standard correction" 4 "Scientific correction" 5 "Co-partisan correction" 6 "Opposition correction"
label val condition condlab2

label def issuelab 1 "Climate change" 2 "COVID-19" 3 "Vaccines" 
label val issue issuelab 

cibar accuracy, over(condition issue) /*vce(cluster rid)*/ graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*.75) region(lpattern(solid) lcolor(black))) ytitle("") scheme(cleanplots) yscale(r(1 4.01)) ylab(1 "Not at all accurate" 2 "Not very accurate" 3 "Somewhat accurate" 4 "Very accurate",angle(0) grid glcolor(gs3)))
graph export "Figures/accuracy-by-issue-and-condition.pdf", replace

cibar accuracy if climate==1, over(condition) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) size(*.8) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/accuracy-climate.png", replace

cibar accuracy if covid==1, over(condition) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) size(*.8) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/accuracy-covid.png", replace

cibar accuracy if vaccine==1, over(condition) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) size(*.8) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/accuracy-vaccine.png", replace

label def partylab 0 "Democrats" 1 "Republicans"
label val gop partylab

cibar accuracy if climate==1 & (dem==1 | gop==1), over(condition gop) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*.75) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 4.01)) ylab(1 "Not at all accurate" 2 "Not very accurate" 3 "Somewhat accurate" 4 "Very accurate",angle(0) grid glcolor(gs3)))
graph export "Figures/accuracy-climate-party.pdf", replace

cibar accuracy if covid==1 & (dem==1 | gop==1), over(condition gop) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) size(*.8) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/accuracy-covid-party.png", replace

cibar accuracy if vaccine==1 & (dem==1 | gop==1), over(condition gop) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) size(*.8) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/accuracy-vaccine-party.png", replace

restore


*exploratory analysis of individual-level threat as a moderator

preserve

rename cc_dv_accuracy accuracy1
rename cov_dv_accuracy accuracy2
rename vac_dv_accuracy accuracy3

reshape long accuracy, i(rid) j(issue)

gen climate=(issue==1)
gen covid=(issue==2)
gen vaccine=(issue==3)

gen high_threat_climate = cc_threat>2 if cc_threat!=.
gen high_threat_covid = cov_threat>2 if cov_threat!=.
gen high_threat_vaccine = vacc_threat>2 if vacc_threat!=.

reg acc misinfo##high_threat_climate std_correction##high_threat_climate sci_correction##high_threat_climate cop_correction##high_threat_climate opp_correction##high_threat_climate interest knowledge sci_trust approval nonwhite college gop male i.agegroup if issue == 1 & (dem==1 | gop==1), robust cluster(rid) 
est store A

lincom 1.cop_correction#1.high_threat_climate - 1.sci_correction#1.high_threat_climate

reg acc misinfo##high_threat_covid std_correction##high_threat_covid sci_correction##high_threat_covid cop_correction##high_threat_covid opp_correction##high_threat_covid interest knowledge sci_trust approval nonwhite college gop male i.agegroup if issue == 2 & (dem==1 | gop==1), robust cluster(rid) 
est store B

lincom 1.cop_correction#1.high_threat_covid - 1.sci_correction#1.high_threat_covid 

reg acc misinfo##high_threat_vaccine std_correction##high_threat_vaccine sci_correction##high_threat_vaccine cop_correction##high_threat_vaccine opp_correction##high_threat_vaccine interest knowledge sci_trust approval nonwhite college gop male i.agegroup if issue == 3 & (dem==1 | gop==1), robust cluster(rid) 
est store C

lincom 1.cop_correction#1.high_threat_vaccine - 1.sci_correction#1.high_threat_vaccine

estout A B C using "Tables/accuracy-perceived-threat.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

restore



*pooled credibility models

preserve

rename cc_dv_credible credibility1
rename cov_dv_credible credibility2
rename vac_dv_credible credibility3

reshape long credibility, i(rid) j(issue)

gen climate=(issue==1)
gen covid=(issue==2)
gen vaccine=(issue==3)

gen second=.
replace second=cc_second if climate==1
replace second=covid_second if covid==1
replace second=vac_second if vaccine==1

gen third=.
replace third=cc_third if climate==1
replace third=covid_third if covid==1
replace third=vac_third if vaccine==1

*H3
reg credibility sci_correction##climate sci_correction##covid cop_correction##climate cop_correction##covid opp_correction##climate opp_correction##covid interest knowledge sci_trust approval nonwhite college gop male i.agegroup /*second third*/, cluster(rid)
est store F

estout F using "Tables/credibility-pooled.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

*deviation: typos corrected

*H3a 
lincom 1.cop_correction#1.climate - 1.sci_correction#1.climate

*H3b
lincom (1.cop_correction#1.covid - 1.sci_correction#1.covid)-(1.cop_correction#1.climate - 1.sci_correction#1.climate)

*RQ2
lincom 1.cop_correction#1.covid - 1.sci_correction#1.covid

gen condition=.
replace condition=3 if std_correction==1 
replace condition=4 if sci_correction==1 
replace condition=5 if cop_correction==1
replace condition=6 if opp_correction==1

label def condlab2 1 "Control" 2 "Misinfo" 3 "Std." 4 "Sci." 5 "Co-p" 6 "Opp."
label val condition condlab2

cibar credibility, over(condition issue) /*vce(cluster rid)*/ graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) size(*.8) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/credible-by-issue-and-condition.png", replace

cibar credibility if climate==1, over(condition) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) size(*.8) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/credible-climate.png", replace

cibar credibility if covid==1, over(condition) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) size(*.8) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/credible-covid.png", replace

cibar credibility if vaccine==1, over(condition) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) size(*.8) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/credible-vaccine.png", replace

label def partylab 0 "Dem" 1 "GOP"
label val gop partylab

cibar credibility if climate==1 & (dem==1 | gop==1), over(condition gop) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) size(*.8) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/credible-climate-party.png", replace

cibar credibility if covid==1 & (dem==1 | gop==1), over(condition gop) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) size(*.8) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/credible-covid-party.png", replace

cibar credibility if vaccine==1 & (dem==1 | gop==1), over(condition gop) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(row(1) pos(6) size(*.8) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/credible-vaccine-party.png", replace

restore

*response quality
tab troll /*5% always/most*/
tab effort /*85% didn't look up*/

*exploratory MC passage rate by correction condition
preserve
rename cc_corr_check corr_check1
rename cov_corr_check corr_check2
rename vac_corr_check corr_check3

reshape long corr_check, i(rid) j(issue)

gen climate=(issue==1)
gen covid=(issue==2)
gen vaccine=(issue==3)

gen second=.
replace second=cc_second if climate==1
replace second=covid_second if covid==1
replace second=vac_second if vaccine==1

gen third=.
replace third=cc_third if climate==1
replace third=covid_third if covid==1
replace third=vac_third if vaccine==1

reg corr_check sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup if (dem==1 | gop==1) & (treatment>2 & treatment<7) & issue==1 & second==0 & third==0, robust
est store A
reg corr_check sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup if (dem==1 | gop==1) & (treatment>2 & treatment<7) & issue==2 & second==0 & third==0, robust
est store B
reg corr_check sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup if (dem==1 | gop==1) & (treatment>2 & treatment<7) & issue==3 & second==0 & third==0, robust
est store C

estout A B C using "Tables/mc-corrections.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

reg corr_check sci_correction##gop cop_correction##gop opp_correction##gop interest knowledge sci_trust approval nonwhite college gop male i.agegroup if (dem==1 | gop==1) & (treatment>2 & treatment<7) & issue==1 & second==0 & third==0, robust
est store A

lincom 1.opp_correction-1.sci_correction
lincom (1.opp_correction+1.opp_correction#1.gop)-(1.sci_correction+1.sci_correction#1.gop)

reg corr_check sci_correction##gop cop_correction##gop opp_correction##gop interest knowledge sci_trust approval nonwhite college gop male i.agegroup if (dem==1 | gop==1) & (treatment>2 & treatment<7) & issue==2 & second==0 & third==0, robust
est store B

lincom 1.opp_correction-1.sci_correction
lincom (1.opp_correction+1.opp_correction#1.gop)-(1.sci_correction+1.sci_correction#1.gop)

reg corr_check sci_correction##gop cop_correction##gop opp_correction##gop interest knowledge sci_trust approval nonwhite college gop male i.agegroup if (dem==1 | gop==1) & (treatment>2 & treatment<7) & issue==3 & second==0 & third==0, robust
est store C

lincom 1.opp_correction-1.sci_correction
lincom (1.opp_correction+1.opp_correction#1.gop)-(1.sci_correction+1.sci_correction#1.gop)

estout A B C using "Tables/mc-corrections-party.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

restore

*exploratory time on correction page analysis

rename correction_timer_Page_Submit corr_time_covid
rename cc_corr_timer_Page_Submit corr_time_climate
rename vac_corr_timer_Page_Submit corr_time_vaccine

preserve
rename corr_time_climate corr_time1
rename corr_time_covid corr_time2
rename corr_time_vaccine corr_time3

reshape long corr_time, i(rid) j(issue)
tab issue

gen climate=(issue==1)
gen covid=(issue==2)
gen vaccine=(issue==3)

gen second=.
replace second=cc_second if climate==1
replace second=covid_second if covid==1
replace second=vac_second if vaccine==1

gen third=.
replace third=cc_third if climate==1
replace third=covid_third if covid==1
replace third=vac_third if vaccine==1

reg corr_time sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup if (dem==1 | gop==1) & (treatment>2 & treatment<7) & issue==1 & corr_time<600 & second==0 & third==0, robust
est store A
reg corr_time sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup if (dem==1 | gop==1) & (treatment>2 & treatment<7) & issue==2 & corr_time<600 & second==0 & third==0, robust
est store B
reg corr_time sci_correction cop_correction opp_correction interest knowledge sci_trust approval nonwhite college gop male i.agegroup  if (dem==1 | gop==1) & (treatment>2 & treatment<7) & issue==3 & corr_time<600 & second==0 & third==0, robust
est store C

estout A B C using "Tables/time-corrections.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

restore
